﻿using System;
using System.Collections.Generic;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Communication.Serial;

namespace Test.TestCommunication {
    /// <summary>
    /// 测试串口
    /// </summary>
    class TestSerial {
        /// <summary>
        /// 启动测试
        /// </summary>
        public void Startup()
        {
            SerialParam param = new SerialParam("COM2",9600,8,StopBits.One, Parity.None);
            SerialCom com = new SerialCom(param);
            SerialProData prodata = new SerialProData();
            com.OpenSerial();
            com.StartRecevice();
            com.receiveData += prodata.ProRecevice;

            SerialParam param2 = new SerialParam("COM4",9600,8,StopBits.One,Parity.None);
            SerialCom com2 = new SerialCom(param2);
            SerialProData prodata2 = new SerialProData();
            com2.OpenSerial();
            com2.StartRecevice();
            com2.receiveData += prodata.ProRecevice;
        }
    }
}
